import api from '../api.config'
import { axios } from '@/utils/request'

/**
 * 获取在线更新信息
 */
export function info () {
  return axios({
    url: api.cloud.upgrade.info,
    method: 'get'
  })
}

/**
 * 在线升级
 * @param {Number} versionId
 */
export function update (versionId) {
  return axios({
    url: api.cloud.upgrade.update,
    method: 'post',
    params: { versionId }
  })
}

/**
 * 下载指定版本
 * @param {Number} versionId
 * @param {String} module
 */
export function download (versionId, module) {
  return axios({
    url: api.cloud.upgrade.download,
    method: 'get',
    params: { versionId, module }
  })
}
